﻿window.history.go(1); //禁浏览器自带的前进后退功能
document.oncontextmenu = function () { event.returnValue = false; }; //禁右键菜单
window.onhelp = function () { return false; }; //禁帮助菜单
//document.onclick = function () {
//    if (window.event.shiftKey && (window.event.srcElement.tagName == "A" || window.event.srcElement.tagName == "a" || window.event.srcElement.tagName == "area")) {
//        //禁按shift新窗口打开a标签
//        window.event.returnValue = false;
//    }
//};

document.onkeydown = function () {
    if (event.ctrlKey && (event.keyCode == 70 || event.keyCode == 78 || event.keyCode == 79 || event.keyCode == 80 || event.keyCode == 82)) {
        //禁Ctrl+(F|N|O|P|R)
        event.keyCode = 0; event.returnValue = false;
    }
    else if (event.keyCode == 122 || event.keyCode == 116) {
        //禁F5，F11
        event.keyCode = 0; event.returnValue = false;
    }
    else if (event.keyCode == 27) {
        //“ESC”键的处理
        SDAlertHide(); ClosePopDiv();
    }
    else if (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password") {
        if ((event.ctrlKey && event.keyCode == 65) || event.keyCode == 8) {
            //禁页面非输入框的Ctrl+A和Backspace
            event.keyCode = 0; event.returnValue = false;
        }
        if ((window.event.keyCode >= 65 && window.event.keyCode <= 90) || (window.event.keyCode >= 48 && window.event.keyCode <= 57) || (window.event.keyCode >= 96 && window.event.keyCode <= 105)) {
            
        }
    }
    else if (event.keyCode == 9)
    {
        event.keyCode = 0; event.returnValue = false;
    }
};